//
//  FPMyViewController.m
//  FilmParadise
//
//  Created by lanou3g on 15/7/13.
//  Copyright (c) 2015年 DLYgroup. All rights reserved.
//

#import "FPMyViewController.h"
#import "FPMyTableFootView.h"
#import "FPMyTableHeadView.h"
@interface FPMyViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic , strong)UITableView *tableView;
@property (nonatomic , strong)UIView *statusBarView;
@end

@implementation FPMyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    FPMyTableFootView *footV = [[FPMyTableFootView alloc]init];
    self.tableView.tableFooterView = footV;
       [self hideNavigationBlackLine];
}
- (void)hideNavigationBlackLine
{
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kImageH(30))];
    label.textAlignment = 1;
    label.textColor = [UIColor whiteColor];
    label.text = @"用户";
    label.font = [UIFont fontWithName:@"Zapfino" size:24];
    self.navigationItem.titleView = label;
    self.navigationController.navigationBar.backgroundColor = [UIColor colorWithRed:0.180 green:0.596 blue:1.000 alpha:1.000];
    self.statusBarView.frame =CGRectMake(0, 0, kScreenWidth  , 20);
    _statusBarView.backgroundColor = [UIColor colorWithRed:0.180 green:0.596 blue:1.000 alpha:1.000];

    if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
        NSArray *list=self.navigationController.navigationBar.subviews;
        for (id obj in list) {
            if ([obj isKindOfClass:[UIImageView class]]) {
                UIImageView *imageView=(UIImageView *)obj;
                NSArray *list2=imageView.subviews;
                for (id obj2 in list2) {
                    if ([obj2 isKindOfClass:[UIImageView class]]) {
                        UIImageView *imageView2=(UIImageView *)obj2;
                        imageView2.hidden=YES;
                    }
                }
            }
        }
    }
}
- (void)viewWillAppear:(BOOL)animated
{
    //self.tabBarController.tabBar.hidden = NO;
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
    //self.automaticallyAdjustsScrollViewInsets = NO;
    //  [self.view setBounds:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"cgClear"] forBarMetrics:UIBarMetricsDefault];
   // _statusBarView.backgroundColor = [UIColor clearColor];
    //self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    if (indexPath.row == 0) {
        cell.textLabel.text = @"我的电影收藏";
    }
    else if (indexPath.row == 1)
    {
        cell.textLabel.text = @"修改资料";
    }
    else if (indexPath.row == 2)
    {
        cell.textLabel.text = @"设置";
    }
    else if (indexPath.row == 3)
    {
        cell.textLabel.text = @"意见反馈";
    }
    
    
    return cell;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    FPMyTableHeadView *headV = [[FPMyTableHeadView alloc]init];
    return headV;
}
   //- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
//{
//    FPMyTableFootView *footV = [[FPMyTableFootView alloc]init];
//    return footV;
//}
//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
//{
//    return kImageH(80) ;
//}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return kImageH(100) ;
}
#pragma mark 懒加载
-(UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight ) style:UITableViewStyleGrouped];
        [self.view addSubview:_tableView];
    }
    return _tableView;
}
- (UIView *)statusBarView
{
    if (!_statusBarView) {
        _statusBarView = [[UIView alloc]init];
        [self.view addSubview:_statusBarView];
    }
    return _statusBarView;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
